/*
 * myrfm12conf.h
 *
 *  Created on: 24.03.2010
 *      Author: mydani
 */

/* Project specific includes */
#include "../main.h"

#ifndef MYRFM12CONF_H_
#define MYRFM12CONF_H_

/*! \file myrfm12conf.h
 *  This file has to be adapted by you to configure the myrfm12 library.  */

#define MYRFM12_ADDR			3
#define ACK 					1
#define NACK					0

/*! \defgroup SWITCHES Configuration Switches */
/*@{*/

	/*! \defgroup MYRFM12_CONF_SPI MYRFM12_CONF_SPI
	 *  \brief Configuration Switch MYRFM12_CONF_SPI sets which kind of
	 *  connection to the rfm12 module shall be used */
	/*@{*/
		/*!\def MYRFM12_CONF_SPI_HW
		 * \brief Option 1: MYRFM12_CONF_SPI_HW if HW SPI is used */
		#define MYRFM12_CONF_SPI_HW			1
		/*!\def MYRFM12_CONF_SPI_SW
		 * \brief Option 2: MYRFM12_CONF_SPI_SW if SW SPI is used */
		#define MYRFM12_CONF_SPI_SW			2
		/*! \def MYRFM12_CONF_SPI
		 *  \brief      Current setting */
		#define MYRFM12_CONF_SPI			MYRFM12_CONF_SPI_HW
	/*@}*/

	/*! \defgroup MYRFM12_CONF_DEBUG MYRFM12_CONF_DEBUG
	 *  \brief Configuration Switch MYRFM12_CONF_DEBUG sets whether the debug
	 *  variable(s) shall be used or not. */
	/*@{*/
		/*!\def MYRFM12_CONF_DEBUG_NO
		 * \brief Option 1: MYRFM12_CONF_DEBUG_NO if you do not want to debug */
		#define MYRFM12_CONF_DEBUG_NO			1
		/*!\def MYRFM12_CONF_DEBUG_YES
		 * \brief Option 2: MYRFM12_CONF_DEBUG_YES if you do want to debug */
		#define MYRFM12_CONF_DEBUG_YES			2
		/*! \def MYRFM12_CONF_DEBUG
		 *  \brief      Current setting */
		#define MYRFM12_CONF_DEBUG			MYRFM12_CONF_DEBUG_NO
	/*@}*/

	/*! \defgroup MYRFM12_CONF_SETUPMETHOD MYRFM12_CONF_SETUPMETHOD
	 *  \brief Configuration Switch MYRFM12_CONF_SETUPMETHOD sets whether the
	 *  standard or a custom routine (has to be implemented by the user) will
	 *  be used */
	/*@{*/
		/*!\def MYRFM12_CONF_SETUPMETHOD_STD
		 * \brief Option 1: MYRFM12_CONF_SETUPMETHOD_STD if the standard setup method
		 * shall be used */
		#define MYRFM12_CONF_SETUPMETHOD_STD			1
		/*!\def MYRFM12_CONF_SETUPMETHOD_CUS
		 * \brief Option 2: MYRFM12_CONF_SETUPMETHOD_CUS if a custom setup method
		 * shall be used */
		#define MYRFM12_CONF_SETUPMETHOD_CUS			2
		/*! \def MYRFM12_CONN
		 *  \brief      Current setting */
		#define MYRFM12_CONF_SETUPMETHOD	MYRFM12_CONF_SETUPMETHOD_STD
	/*@}*/

/*@}*/

/*! \defgroup SETTINGS Configuration Settings */
/*@{*/

	/*! \defgroup SPI_PORT SPI Port
	 * \brief      Defines for the SPI port */
	/*@{*/
		/*! \def MYRFM12_PORT
		 *  \brief Port of the AVR on which the module is connected to */
		#define MYRFM12_CONF_PORT		PORTB
		/*! \def MYRFM12_DDR
		 *  \brief Data direction register of the used port */
		#define MYRFM12_CONF_DDR  		DDRB
		/*! \def MYRFM12_PIN
		 *  \brief Pin assignment */
		#define MYRFM12_CONF_PIN		PINB
		/*! \def MYRFM12_SDI
		 *  \brief The Pin-Number of the AVR that is connected with the SDI-Pin
		 *  of the RFM12 */
		#define MYRFM12_CONF_SDI		3
		/*! \def MYRFM12_SCK
		 *  \brief The Pin-Number of the AVR that is connected with the SCK-Pin
		 *  of the RFM12 */
		#define MYRFM12_CONF_SCK		5
		/*! \def MYRFM12_CS
		 *  \brief The Pin-Number of the AVR that is connected with the nSEL-Pin
		 *   of the RFM12 */
		#define MYRFM12_CONF_CS			2
		/*! \def MYRFM12_SDO
		 *  \brief The Pin-Number of the AVR that is connected with the SDO-Pin
		 *   of the RFM12 */
		#define MYRFM12_CONF_SDO		4
		/*! \def MYRFM12_NIRQ
		 *  \brief Optional Pin-Assignments; The Pin-Number of the AVR that is
		 *  connected with the nIRG-Pin of the RFM12 */
		#define MYRFM12_CONF_NIRQ		1
	/*@}*/

	/*! \defgroup STATIC_RFM12 Static RFM12 parameters.
	 *  \brief These parameters will be used for the initial setup of the rfm12
	 *  module. */
	/*@{*/

		/*! \def MYRFM12_CONF_SETUP_FREQUENCY
		 *  \brief The rfm12 module will initially be setup with this
		 *   transmission frequency. Supported intervals:
		 *   310,09 -> 319,7575 (in 0,0025 steps)
		 *   430,09 -> 439,7575(in 0,0025 steps)
		 *   860,18 -> 879,515 (in 0,005 steps)
		 *   900,27 -> 929,2725 (in 0,0075 steps)
		 *   The value has to have a resolution of 1/10kHz.
		 *   Means for 430,0925MHz, the define has to be set to 4300925. */
		#define MYRFM12_CONF_SETUP_FREQUENCY 4339200

		/*! \def MYRFM12_CONF_SETUP_CAPACITOR
		 *  \brief The rfm12 module will initially be setup with this
		 *   capacitor. Use the defines starting with
		 *   MYRFM12_CMD__CONFIG__CAPACITOR for this parameter */
		#define MYRFM12_CONF_SETUP_CAPACITOR MYRFM12_CMD__CONFIG__CAPACITOR12

		/*! \def MYRFM12_CONF_SETUP_BAUDRATE
		 *  \brief The rfm12 module will initially be setup with this
		 *   baudrate.*/
		#define MYRFM12_CONF_SETUP_BAUDRATE			19200

		/*! \def MYRFM12_CONF_SETUP_POWER
		 *  \brief The rfm12 module will initially be setup with this
		 *   transmission power. Value can be between 0 and 7, 7 meaning
		 *   maximum power, 0 least power. Each decrease by one means a
		 *   decrease of the power by 3dBm. */
		#define MYRFM12_CONF_SETUP_POWER			7

		/*! \def MYRFM12_CONF_SETUP_FREQDEV
		 *  \brief The rfm12 module will initially be setup with this
		 *   transmission frequency deviation. Value can be between 0 and 15,
		 *   15 meaning a deviation of 240kHz. Each decrease by one means a
		 *   decrease of 15khz.
		 *   Frequency deviation means the difference of the frequency(high/low)
		 *   when transmitting in frequency modulation mode. */
		#define MYRFM12_CONF_SETUP_FREQDEV			6

		/*! \def MYRFM12_CONF_SETUP_MODULATIONPOLARITY
		 *  \brief The rfm12 module will initially be setup with this
		 *   transmission modulation polarity. Value can be between 0 and 1. */
		#define MYRFM12_CONF_SETUP_MODULATIONPOLARITY			0

		/*! \def MYRFM12_CONF_SETUP_TX_START
		 *  \brief Can be mapped to a function which is called whenever tx
		 *  starts. */
		#define MYRFM12_CONF_SETUP_TX_START

		/*! \def MYRFM12_CONF_SETUP_TX_STOP
		 *  \brief Can be mapped to a function which is called whenever tx
		 *  stops. */
		#define MYRFM12_CONF_SETUP_TX_STOP

		/*! \def MYRFM12_CONF_SETUP_RX_START
		 *  \brief Can be mapped to a function which is called whenever rx
		 *  starts. */
		#define MYRFM12_CONF_SETUP_RX_START

		/*! \def MYRFM12_CONF_SETUP_RX_STOP
		 *  \brief Can be mapped to a function which is called whenever rx
		 *  stops. */
		#define MYRFM12_CONF_SETUP_RX_STOP

		/*! \def MYRFM12_CONF_RX_BUFFER_SIZE
		 *  \brief Size of bytes which can be received. */
		#define MYRFM12_CONF_RX_BUFFER_SIZE	8

#if(MYRFM12_CONF_DEBUG == MYRFM12_CONF_DEBUG_YES)
		/*!\brief  myrfm12_debug is called whenever a byte is transmitted */
		void myrfm12_debug(uint16_t cmd);
#endif
	/*@}*/

/*@}*/

#endif /* MYRFM12CONF_H_ */
